<?php

namespace app\model;
use app\service\MemberService;
use think\model\concern\SoftDelete;
use app\utils\NumText;
class Task extends BaseModel
{
    use SoftDelete;
    protected $deleteTime = 'delete_at';
    protected $table = 'task';


    public function getStatusTextAttr($value, $data)
    {
        return NumText::statusText($data['status']??'');
    }

    // 关联任务分类表
    public function taskCategory()
    {

        return $this->belongsTo('TaskCategory', 'task_category_id', 'id')->withTrashed();
    }

    public function getIsAttachmentTextAttr($value, $data){
        return NumText::isTxt($data['is_attachment']??'');
    }

    // public function getPriceAttr($value, $data)
    // {
    //     return $value;
    //     // $memberSer = new MemberService;
    //     // $memberDiscount = $memberSer->getMemberVipDiscount($memberSer->getMemberVipId());
    //     // return $memberDiscount>0?sprintf("%.2f",$value+sprintf("%.2f",($value*$memberDiscount)/100)):$value;

    // }
}
